declare const x: object | null; if (x) {}

<T extends {} | null | undefined>(x: T) => x ? 1 : 0;
// output: declare const x: object | null; if (x != null) {}

// output: <T extends {} | null | undefined>(x: T) => (x != null) ? 1 : 0;